package cn.gcyl.module.biz.dal.mysql.memberorder;

import java.util.*;

import cn.gcyl.framework.common.pojo.PageResult;
import cn.gcyl.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.gcyl.framework.mybatis.core.mapper.BaseMapperX;
import cn.gcyl.module.biz.dal.dataobject.memberorder.MemberOrderDO;
import org.apache.ibatis.annotations.Mapper;
import cn.gcyl.module.biz.controller.admin.memberorder.vo.*;

/**
 * 会员订单管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MemberOrderMapper extends BaseMapperX<MemberOrderDO> {

    default PageResult<MemberOrderDO> selectPage(MemberOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MemberOrderDO>()
                .likeIfPresent(MemberOrderDO::getMembershipName, reqVO.getMembershipName())
                .eqIfPresent(MemberOrderDO::getPaymentAmount, reqVO.getPaymentAmount())
                .eqIfPresent(MemberOrderDO::getNumber, reqVO.getNumber())
                .betweenIfPresent(MemberOrderDO::getEffectiveTime, reqVO.getEffectiveTime())
                .eqIfPresent(MemberOrderDO::getUserId, reqVO.getUserId())
                .likeIfPresent(MemberOrderDO::getNickname, reqVO.getNickname())
                .eqIfPresent(MemberOrderDO::getMobile, reqVO.getMobile())
                .betweenIfPresent(MemberOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MemberOrderDO::getId));
    }

}